package org.example.mallchat.exception;

/**
 * 自定义错误码
 *
 * @author <a href="https://gitee.com/zzhpalus">zzhKing</a>
 * @from <a href="https://gitee.com/zzhpalus">致力于学习</a>
 */
public enum ErrorCode {

    SUCCESS(0, "ok"),
    PARAMS_ERROR(40000, "请求参数错误"),
    NOT_LOGIN_ERROR(40100, "未登录"),
    NO_AUTH_ERROR(40101, "无权限"),
    NOT_FOUND_ERROR(40400, "请求数据不存在"),
    FORBIDDEN_ERROR(40300, "禁止访问"),
    LOGIN_CONFLICT(40800, "登录冲突"),
    IP_BLACK(40801, "黑名单"),
    SYSTEM_ERROR(50000, "系统内部异常"),
    OPERATION_ERROR(50001, "操作失败"),
    NAME_VALIDATE_ERROR(50002, "名字过长或过短"),
    NAME_CARD_NOT_ENOUGH(50003, "改名卡不足"),
    BADGE_NOT_EXIST(50004, "徽章不存在" ),
    FREQUENT_REQUEST(50005, "频繁请求")
    , USER_NOT_EXIST(50006, "用户不存在");

    /**
     * 状态码
     */
    private final int code;

    /**
     * 信息
     */
    private final String message;

    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

}
